<%@ page import="java.util.Date" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/layouts/taglib.jsp" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>创建AlbumPicture</title>
		<link rel="stylesheet" href="${staticPath}/admin/tcsf/reset.css" />
		<link href="${staticPath}/admin/iconfont/iconfont.css" type="text/css" rel="stylesheet" />
		<link rel="stylesheet" href="${staticPath}/admin/lib/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
		<link rel="stylesheet" href="${staticPath}/admin/lib/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css" />
		<link rel="stylesheet" href="${staticPath}/admin/tcsf/tcsf.panel.css" />
		<link rel="stylesheet" href="${staticPath}/admin/tcsf/content.css" />

		<script src="${staticPath}/admin/tcsf/jquery.min.js"></script>
		<script src="${staticPath}/admin/lib/jquery.form/jquery.form.min.js"></script>
		<script src="${staticPath}/admin/lib/jquery.form/jquery.validate.min.js"></script>
		<script src="${staticPath}/admin/lib/jquery.form/jquery.validate.extend.js"></script>
		<script src="${staticPath}/admin/lib/jquery.form/messages_zh.js"></script>
		<script type="text/javascript" src="${staticPath}/admin/lib/bootstrap-3.3.7-dist/js/bootstrap.min.js" ></script>
		<script type="text/javascript" src="${staticPath}/admin/lib/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js" ></script>
		<script type="text/javascript" src="${staticPath}/admin/tcsf/content.js" ></script>
	</head>
	<body>

		<div class="create-page tpanel">
			<div class="panel-content">
				<div class="container-fluid">
			
					<form id="createForm" class="form-horizontal">
						
						<div class="form-group form-group-first">
							<label for="name" class="col-sm-2 control-label">名称</label>
							<div class="col-sm-8">
								<input type="text" class="form-control"  
									id="name" name="name" 
									value="" 
										placeholder="请输入名称(必填)" required 

									minlength="0" maxlength="100" 
									/>
							</div>
						</div>
						
						<div class="form-group">
							<label for="description" class="col-sm-2 control-label">描述</label>
							<div class="col-sm-8">
								<input type="text" class="form-control"  
									id="description" name="description" 
									value="" 
										placeholder="请输入描述" 

									minlength="0" maxlength="1000" 
									/>
							</div>
						</div>
						
						<div class="form-group">
							<label for="type" class="col-sm-2 control-label">类型</label>
							<div class="col-sm-8">
								<input type="text" class="form-control"  
									id="type" name="type" 
									value="" 
										placeholder="请输入类型(必填)" required 

									minlength="0" maxlength="20" 
									/>
							</div>
						</div>
					  	
					  	<div class="form-group">
							<div class="col-sm-12" style="text-align: center;">
								<a class="btn btn-default" href="javascript:window.history.back();">返回</a>
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<input type="submit" class="btn btn-primary" value="保存" />
							</div>
					  	</div>
					  	
					</form>
				
				</div>
			</div>
		</div>
		<script type="text/javascript">
			window.parent.changeTitle('创建AlbumPicture');
			$(function() {
				
				
				
				
                $('#createForm').validate({
                    focusCleanup:true,
					focusInvalid:false,
                    errorClass: "unchecked",
                    validClass: "checked",
                    errorElement: "span",
                    submitHandler:function(form){
                        $(form).ajaxSubmit({
                            type:"post",
                            url:"${ctx}/admin/albumpicture/create",
                            beforeSubmit: function() {
								window.parent.layer.load();
							},
                            success: function(r) {
                                var resp = $.parseJSON(r);
                                window.parent.layer.closeAll('loading');
                                if(resp.code == 'OK') {
                                    window.location.href = '${ctx}/admin/albumpicture';
                                    window.parent.layer.msg('保存成功', {icon: 1});
                                }else {
                                    window.parent.layer.msg(resp.message, {icon: 2});
                                }
							}
                        });
                        return false;
                    },
                    errorPlacement:function(error,element){
                        var s = element.parent().find("span[htmlFor='" + element.attr("id") + "']");
                        if(s!=null){
                            s.remove();
                        }
                        error.appendTo(element.parent());
                    },
                    success: function(label) {
                        label.removeClass("unchecked").addClass("checked");
                    }
                });
				$('.datetimepicker').datetimepicker({format:'yyyy-mm-dd hh:ii:ss'});
			});
		</script>
	</body>
</html>
